package net.sunofbeach.blog.controller.portal;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sunofbeach.blog.response.Result;
import net.sunofbeach.blog.service.LabelService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Bing
 * @since 2021-11-24
 */
@Api(tags = "门户标签管理")
@RestController
@RequestMapping("/label")
public class LabelPortalApi {

    @Resource
    private LabelService labelService;

    /**
     * 获取标签云
     * 用户点击标签，就会通过标签获取相关的文章列表
     *
     * @param size
     * @return
     */
    @ApiOperation("获取标签云")
    @GetMapping("/label/{size}")
    public Result getLabels(@PathVariable("size") int size) {
        return labelService.listLabels(size);
    }

}

